﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using DG.Tweening;
using Path = DG.Tweening.Plugins.Core.PathCore.Path;

namespace linkouqs.Gamekit {



    public abstract class TakeableObject : ThrowableObject {


        public string SlotName;
        
        public GameObject trigger;
        
        protected virtual void Awake() {

            var listener = Physical2DEventLinstener.Get(trigger);

            listener.onTriggerEnter2D = go => {
                CharacterAbilityTake user = go.GetComponent<CharacterAbilityTake>();
                if (user == null) {
                    return;
                }
                //Debug.LogWarning(user.name);
                user.OnSelect(this);
            };
            listener.onTriggerExit2D = go => {
                CharacterAbilityTake user = go.GetComponent<CharacterAbilityTake>();
                if (user == null) {
                    return;
                }
                user.OnUnselect(this);
            };
        }


        public virtual Path GetTakePath(Transform slot) {
            return null;
        }

        public virtual void OnTake() {

        }
    }

}
